小端返回1,大端返回0,不论机器字长
我想现在应该不会有人还在用8位处理器,以兄弟们的家境至少都应该是16位的吧
bool is_little_endian(){ uint16_t x=0x1234; return (*(char *)(&x))==0x34; }